<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/struts-dojo-tags" prefix="sx" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>用户登录</title>
		<link rel="stylesheet" type="text/css" href="/carcenter/css/style_new.css" />
		<sx:head parseContent="true"/>
		<script type="text/javascript">
			function confirm(pwd){
				if(pwd.length ==0){
					document.getElementById("ptishi").innerHTML = "密码不能为空";
				}else{
					document.getElementById("ptishi").innerHTML = "";
				}
			}
			
			function confirmPwd(rePwd){
				var pwd = document.getElementById("pwd").value;
				if(rePwd != pwd){
					document.getElementById("tishi").innerHTML = "密码不一致";
				}else{
					document.getElementById("tishi").innerHTML = "";
				}
			}
			
			String.prototype.trim = function(){
				return this.replace(/(^\s*)|(\s*$)/g, "");
			}
			
			function check(val,id){
				if(val.trim() == ""){
					document.getElementById(id).innerHTML = "不能为空";
				}else{
					document.getElementById(id).innerHTML = "";
				}
			}
			
			function sub(){
				var name = document.getElementById("name").value;
				if(name.trim() == ""){
					document.getElementById("ntishi").innerHTML = "不能为空";
					return false;
				}
				var pwd = document.getElementById("pwd").value;
				if(pwd.length == 0){
					document.getElementById("ptishi").innerHTML = "密码不能为空";
					return false;
				}else{
					var repwd = document.getElementById("repwd").value;
					if(repwd != pwd){
						document.getElementById("tishi").innerHTML = "密码不一致";
						return false;
					}
				}
				var realname = document.getElementById("realname").value;
				if(realname.trim() == ""){
					document.getElementById("rtishi").innerHTML = "不能为空";
					return false;
				}
				document.register.submit();
			}
		</script>
	</head>
	<body>
		<div id="wrap">
			<s:include value="../header.jsp" />
			<div class="center_content">
				<div class="left_content">
					<div class="title">
						<span class="title_icon"><img src="/carcenter/images/bullet1.gif" alt="" title="" /></span>
						用户注册
					</div>
					<div class="feat_prod_box_details">
						<div class="contact_form">
							<s:property value="msg"/>
							<s:form id="register" name="register" action="/registerUser.action">
								<div class="form_row">
									<label class="contact_new">
										<strong>用&nbsp;&nbsp;户&nbsp;&nbsp;名:</strong>
									</label>
									<s:textfield name="user.username" onblur="check(this.value,'ntishi')" id="name"></s:textfield>
									<label id="ntishi"></label>
								</div>
								
								<div class="form_row">
									<label class="contact_new">
										<strong>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</strong>
									</label>
									<s:password name="user.pwd" onblur="confirm(this.value)" id="pwd"></s:password>
									<label id="ptishi"></label>
								</div>

								<div class="form_row">
									<label class="contact_new">
										<strong>确认密码:</strong>
									</label>
									<s:password name="repwd" onblur="confirmPwd(this.value)" id="repwd"></s:password>
									<label id="tishi"></label>
								</div>
								
								<div class="form_row">
									<label class="contact_new">
										<strong>真实姓名:</strong>
									</label>
									<s:textfield name="user.realname" onblur="check(this.value,'rtishi')" id="realname"></s:textfield>
									<label id="rtishi"></label>
								</div>

								<div class="form_row">
									<label class="contact_new">
										<strong>性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</strong>
									</label>
									<s:radio list="{'男','女'}" name="user.sex" value="'男'" ></s:radio>
								</div>

								<div class="form_row">
									<label class="contact_new">
										<strong>生&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日:</strong>
									</label>
									<sx:datetimepicker name="user.birthday" type="date" displayFormat="yyyy-MM-dd" value="%{'today'}" ></sx:datetimepicker>
								</div>

								<div class="form_row">
									<label class="contact_new">
										<strong>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址:</strong>
									</label>
									<s:textfield name="user.address"></s:textfield>
									<!-- 默认非vip用户 -->
									<s:hidden name="user.isvip" value="N"></s:hidden>
								</div>
									<input type="button" value="注册" onclick="sub();"></input>
							</s:form>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
			<s:include value="../footer.jsp" />
		</div>
	</body>
</html>
